package com.zto.sch.base.list;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @program: sch-diy-parent
 * @description:
 * @author: sch
 * @create: 2021-01-24 15:37
 **/
public class FillingLists {
    public static void main(String[] args) {
        List<StringAddress> list = new ArrayList<>(
                Collections.nCopies(4, new StringAddress("哈哈"))
        );
        System.out.println(list);
        Collections.fill(list, new StringAddress("nice"));
        System.out.println(list);
    }

    List<String> list = new ArrayList<>();

    @Test
    public void test() {
        for (int i = 0; i < Integer.MAX_VALUE; i++) {
            list.add("sch-hahahahahahahahahah,sch-hahahahahahahahahah,sch-hahahahahahahahahah" + i);
            System.out.println("结果:" + i);
        }

    }
}
